package io.cici.cc.mybatis.lite.parse;

import java.util.Properties;

public class FixedVariableTokenHandler implements TokenHandler {
    private final Properties variables;


    public FixedVariableTokenHandler(Properties variables) {
        this.variables = variables;
    }

    @Override
    public String handle(String key) {
        if (variables != null) {
            if (variables.containsKey(key)) {
                return variables.getProperty(key);
            } else {
                throw new IllegalArgumentException("请设置值:" + key);
            }

        }
        return "${" + key + "}";
    }
}
